/**
 * MQTT连接配置接口
 */
export interface MqttConfig {
  host: string;
  port: number;
  clientId: string;
  username: string;
  password: string;
  protocol: 'ws' | 'wss' | 'mqtt' | 'mqtts';
  path?: string;
}

/**
 * MQTT连接状态枚举
 */
export enum MqttConnectionStatus {
  CONNECTING = 'connecting',
  CONNECTED = 'connected',
  RECONNECTING = 'reconnecting',
  DISCONNECTED = 'disconnected',
  ERROR = 'error',
}

/**
 * 无人机位置数据接口
 */
export interface DroneLocationData {
  drone_id: string;
  drone_height: number;
  model: string;
  gui_id: string;
  gui_first_detected_at: string;
  created_at: string;
  drone_gps_lat: number;
  drone_gps_lng: number;
  sensor_id: string;
  drone_azimuth: number;
  drone_distance: number;
  rc_gps_lat: number;
  rc_gps_lng: number;
  rc_azimuth: number;
  rc_distance: number;
  request_status: string;
  error_message: string;
}

/**
 * MQTT订阅主题接口
 */
export interface MqttSubscription {
  topic: string;
  qos?: 0 | 1 | 2;
}

/**
 * MQTT数据包接口
 * 简化版本，仅包含在我们的消息处理中使用的关键字段
 */
export interface MqttPacket {
  cmd?: string;           // 命令类型，如'publish'
  topic?: string;         // 主题
  payload?: Buffer;       // 消息内容
}

/**
 * MQTT事件处理函数类型
 */
export type MqttEventHandler = (topic: string, message: Buffer, packet: MqttPacket) => void;

/**
 * MQTT状态变更回调函数类型
 */
export type MqttStatusChangeCallback = (status: MqttConnectionStatus, error?: Error) => void; 